import Vue from 'vue'
import Vuex from './avuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    msg:'广东',
    age:22,
    name:'小明',
    bodyWeight:110,
    hobby:'蓝球,打游戏'
  },
  mutations: {
    changeName(state,value){
      state.name=value
    },
    changeAgeFn(state,value){
      state.age+=value
    },
    changeGetters(state,value){
      state.bodyWeight+=value
    }
  },
  actions: {
    changeAge({commit},payload){
     commit('changeAgeFn',payload)
    }
  },
  getters:{
    changeGettersFn(state){
     return  state.bodyWeight+10
    }
  }
})
